package com.powerteam.model.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 阶段类型
 *
 * @Author jinming.zhang
 * @Date 2021/12/1
 */
public enum OpportunityPhaseEnum {

    /**
     * 阶段 初步接触:1 了解分析:2 提交方案:3 商务谈判:4 关闭:5
     */
    OPPORTUNITY_PHASE_INITIAL((byte) 1, "初步接触"),
    OPPORTUNITY_PHASE_ANALYSIS((byte) 2, "需求分析"),
    OPPORTUNITY_PHASE_AGREEMENT((byte) 3, "协商方案"),
    OPPORTUNITY_PHASE_NEGOTIATION((byte) 4, "商业谈判"),
    OPPORTUNITY_PHASE_ON((byte) 5, "关闭");

    private final Byte code;
    private final String desc;

    OpportunityPhaseEnum(Byte code, String desc) {

        this.code = code;
        this.desc = desc;
    }

    public Byte getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 阶段类型码列表
     *
     * @param except 排除的阶段
     * @return List<Byte>
     * @Author jinming.zhang
     * @Date 2022/1/8
     */
    public static List<Byte> getPhaseCodeList(Byte ...except) {

        List<Byte> phaseCodeList = new ArrayList<>();
        for (OpportunityPhaseEnum value : OpportunityPhaseEnum.values()) {
            phaseCodeList.add(value.getCode());
        }

        // 排除的阶段列表
        if (except != null) {
            phaseCodeList.removeAll(Arrays.asList(except));
        }

        return phaseCodeList;
    }
}
